﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//New and needed
using IM.Common.DTOS;
using IM.Domain.Repository;

namespace IM.Domain.Entities
{
    public class PersonEntity: EntityBase
    {
        protected PersonEntity() { }

        public virtual string FirstName { get; protected set; }
        public virtual string MiddleName { get; protected set; }
        public virtual long IdIdentification { get; protected set; }

        public static PersonEntity Create(IRepositoryLocator repositoryLocator, PersonDTO dto)
        {
            var instance = new PersonEntity
            {
                FirstName = dto.FirstName,
                MiddleName = dto.MiddleName,
                IdIdentification = dto.IdIdentification
            };

            repositoryLocator.Save(instance);
            return instance;
        }
    }
}
